<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>流程管理 - 待办</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="/lib/layui/css/layui.css" media="all" />
	<script src="/lib/layui/layui.js" charset="utf-8"></script>
	<script src="/static/js/main.js"></script>
	<script src="process.js"></script>

	<script type="text/javascript">
		
		function start(){
			startProcess({
				title:"测试流程 title",
				businessId:"1234567890",
				procDefKey:"qingjia"
			});
		}

	</script>


</head>
<body>
<!--
<button onclick="start()">发起流程</button>
-->
<table class="layui-table layui-form" id="dataList" lay-filter="dataList"></table>

<script type="text/html" id="optbar">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="form">办理</a>
</script>

<script>
    var ysb = {};
    var configureCom = {}; 
    layui.use(['table','configureCom'], function () {
        var table = layui.table;
        var $ = layui.jquery;
        configureCom = layui.configureCom;
        var token = localStorage.getToken;
        var cols= [[
            {type: 'checkbox', fixed: 'left'}
            , {field: 'title', title: '流程名称'}
            , {field: 'procDefName', title: '流程类型'}
            , {field: 'name', title: '任务名称'}
            , {field: 'taskPreUser', title: '上一步办理人'}
            , {field: 'startTime', title: '开始时间'}
            , {fixed: 'right', title: '操作', toolbar: '#optbar', width: 150}
        ]];

        ysb.init = function () {
            configureCom.tableRender(baseApi + '/act/manage/todo', {}, cols,'dataList',10,'full-100',false);
        };


		//头工具栏事件
        table.on('toolbar(dataList)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            switch (obj.event) {
                case 'getCheckData':
                    var data = checkStatus.data;
                    layer.alert(JSON.stringify(data));
                    break;
                case 'getCheckLength':
                    var data = checkStatus.data;
                    layer.msg('选中了：' + data.length + ' 个');
                    break;
                case 'isAll':
                    layer.msg(checkStatus.isAll ? '全选' : '未全选');
                    break;
            }
        });

        //监听行工具事件
        table.on('tool(dataList)', function (obj) {
            var data = obj.data;
            //console.log(obj)
            if (obj.event === 'form') {
                window.open("/templates/act/form.html"
                	+"?taskId="+data.id
                	+"&procInstId="+data.procInstId
                	+"&poId="+data.poId
                	+"&title="+encodeURI(data.title)
                	+"&name="+encodeURI(data.name)
                	+"&from=todo"
                );
            }
        });
        //初始化数据
        ysb.init();
        //用户点击搜索
        $('#queryBut').click(function () {
            // ysb.init();
        });
    });


</script>
</body>
</html>